﻿<phone:PhoneApplicationPage
    x:Class="WP8_PPS.Views.SingleSurveyEntryPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:converters="clr-namespace:WP8_PPS.Helpers"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d"
    shell:SystemTray.IsVisible="True">

    <phone:PhoneApplicationPage.Resources>
        <converters:ListPoleConditionConverter x:Key="EnumToListConverter" />
        <converters:SinglePoleConditionConverter x:Key="SinglePoleConverter" />
    </phone:PhoneApplicationPage.Resources>
    
    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot"
          Background="Transparent"
          VerticalAlignment="Top">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="stkPageTitle"
                    HorizontalAlignment="Left"
                    VerticalAlignment="Top"
                    Margin="12,0,0,0">
            <TextBlock x:Name="txtPageTitle"
                       TextWrapping="Wrap"
                       Text="{Binding LocalizedResources.ApplicationTitle,
                                      Mode=OneTime,
                                      Source={StaticResource LocalizedStrings}}"
                       Style="{StaticResource PhoneTextNormalStyle}"
                       Margin="12,15,24,32" />
        </StackPanel>
        <ScrollViewer x:Name="scvEntryData"
                      Grid.Row="1"
                      VerticalAlignment="Top">
            <!--TitlePanel contains the name of the application and page title-->
            <StackPanel x:Name="stkEntryData"
                        Margin="12,17,0,28">
                <TextBlock x:Name="tblLocation"
                           Text="{Binding LocalizedResources.LocationLabel,
                                          Mode=OneTime,
                                          Source={StaticResource LocalizedStrings}}"
                           Style="{StaticResource PhoneTextSubtleStyle}" />
                <Grid x:Name="grdLocation">
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    <TextBox x:Name="txtLongitude"
                             Text="{Binding Longitude,
                                            BindsDirectlyToSource=True,
                                            Mode=TwoWay}"
                             IsEnabled="False" />
                    <TextBox x:Name="txtLatitude"
                             Grid.Row="1"
                             Text="{Binding Latitude,
                                            BindsDirectlyToSource=True,
                                            Mode=TwoWay}"
                             IsEnabled="False"  />
                    <Button x:Name="btnLocate"
                            Content="{Binding LocalizedResources.LocateButtonContent,
                                              Mode=OneTime,
                                              Source={StaticResource LocalizedStrings}}"
                            Grid.Column="1"
                            Grid.RowSpan="2"
                            Command="{Binding LocateCommand}" />
                </Grid>
                <TextBlock x:Name="tblCondition"
                           Text="{Binding LocalizedResources.ConditionLabel,
                                          Mode=OneTime,
                                          Source={StaticResource LocalizedStrings}}"
                           Style="{StaticResource PhoneTextSubtleStyle}"
                           Margin="12,28,12,0" />
                <toolkit:ListPicker x:Name="lspCondition"
                                    ItemsSource="{Binding Converter={StaticResource EnumToListConverter},
                                                          Mode=OneTime}"
                                    SelectedItem="{Binding Condition,
                                                           Converter={StaticResource SinglePoleConverter},
                                                           BindsDirectlyToSource=True,
                                                           Mode=TwoWay}" />
                <TextBlock x:Name="tblHeight"
                           Text="{Binding LocalizedResources.HeightLabel,
                                          Mode=OneTime,
                                          Source={StaticResource LocalizedStrings}}"
                           Style="{StaticResource PhoneTextSubtleStyle}"
                           Margin="12,28,12,0" />
                <TextBox x:Name="txtHeight"
                         Text="{Binding Height,
                                        BindsDirectlyToSource=True,
                                        Mode=TwoWay}"
                         InputScope="Number" />
                <TextBlock x:Name="tblYear"
                           Text="{Binding LocalizedResources.YearLabel,
                                          Mode=OneTime,
                                          Source={StaticResource LocalizedStrings}}"
                           Style="{StaticResource PhoneTextSubtleStyle}"
                           Margin="12,28,12,0" />
                <TextBox x:Name="txtYear"
                         Text="{Binding Year,
                                        BindsDirectlyToSource=True,
                                        Mode=TwoWay}"
                         InputScope="Number" />
                <TextBlock x:Name="tblComments"
                           Text="{Binding LocalizedResources.CommentsLabel,
                                          Mode=OneTime,
                                          Source={StaticResource LocalizedStrings}}"
                           Style="{StaticResource PhoneTextSubtleStyle}"
                           Margin="12,28,12,0" />
                <TextBox x:Name="txtComments"
                         TextWrapping="Wrap"
                         AcceptsReturn="True"
                         VerticalScrollBarVisibility="Visible"
                         Height="288"
                         Text="{Binding Comments,
                                        BindsDirectlyToSource=True,
                                        Mode=TwoWay}"
                         InputScope="Text" />
                <Button Content="{Binding LocalizedResources.SaveButtonContent,
                                          Mode=OneTime,
                                          Source={StaticResource LocalizedStrings}}"
                        Command="{Binding SaveCommand}" />
            </StackPanel>
        </ScrollViewer>
        <!--ContentPanel - place additional content here-->
    </Grid>

</phone:PhoneApplicationPage>